home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1989, Tera Computer Company
- **/
-
- /**
- Implementation of text area.
- First line: graph name, file name
- Second line: status
- **/
-
- #include "istring.h"
- #include "tview.h"
- #include <string.h>
- #include <InterViews/glue.h>
-
- TextView::TextView (char* gname, char* fname)
- {
- line1 = new FirstLine(gname, fname);
- line2 = new SecondLine("\0");
- Init();
- }
-
- void TextView::Init ()
- {
- Insert(line1);
- Insert(line2);
- }
-
- void TextView::ChangeStatusLine (char* s, boolean now)
- {
- line2->ChangeStatus (s);
-
- /**
- unfortunately, this doesn't always work.
- See gframe.c for a solution
- **/
- if (now)
- {
- Draw();
- }
- }
-
- void TextView::ChangeFileName (char* s)
- {
- line1->ChangeFileName (s);
- Draw();
- }
-
- void TextView::ChangeGraphName (char* s)
- {
- line1->ChangeGraphName (s);
- Draw();
- }
-
- FirstLine::FirstLine (char* g, char* f)
- {
- gname = new char[gmax + 1];
- fname = new char[fimax + 1];
-
- strncpy (gname, g, gmax);
- gmsg = new Message(strdup(gname));
- gbox = new HBox();
- gbox->Insert (new Message("Graph Name: "));
- gbox->Insert (gmsg);
-
- strncpy (fname, f, fimax);
- fmsg = new Message(strdup(fname));
- fbox = new HBox();
- fbox->Insert (new Message("File: "));
- fbox->Insert (fmsg);
-
- Insert(gbox);
- Insert(new HGlue);
- Insert(fbox);
- Insert(new HGlue);
- }
-
- void FirstLine::ChangeGraphName (char* s)
- {
- strncpy (gname, s, gmax);
- gbox->Remove(gmsg);
- // delete gmsg;
- /**
- this should work, but may not, and it's not that much
- space, anyway
- **/
- gmsg = new Message(strdup(gname));
- gbox->Insert(gmsg);
- gbox->Change(gmsg);
- }
-
- void FirstLine::ChangeFileName (char* s)
- {
- strncpy (fname, s, fimax);
- fbox->Remove(fmsg);
- // delete fmsg; /* same here */
- fmsg = new Message(strdup(fname));
- fbox->Insert(fmsg);
- fbox->Change(fmsg);
- }
-
- SecondLine::SecondLine (char* s)
- {
- status = new char[smax + 1];
-
- strncpy (status, s, smax);
- smsg = new Message(strdup(status));
- sbox = new HBox();
- sbox->Insert(new Message("Status: "));
- sbox->Insert(smsg);
- Insert(sbox);
- Insert(new HGlue);
- }
-
- void SecondLine::ChangeStatus (char* s)
- {
- strncpy (status, s, smax);
- sbox->Remove(smsg);
- // delete smsg; /* and here, and in many other places. */
- smsg = new Message(strdup(status));
- sbox->Insert(smsg);
- sbox->Change(smsg);
- }
-